﻿using server.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace server
{
    public partial class CarList : Form
    {
        private SQLiteDatabase sql_Excute = new SQLiteDatabase();
        List<VanetRID> RID_all = new List<VanetRID>();
        public CarList()
        {
            InitializeComponent();
            VanetRIDal VRD = new VanetRIDal();
            List<VanetRID> VR = new List<VanetRID>();
            VR = VRD.AllRID();
            for(int i=0;i<VR.Count;i++)
            {
                VanetRID RID_item = VR[i];
                listBox1.Items.Add(RID_item.RID);
                //listBox1.Items.Add(RID_item.RID_trans);
            }
            
        }
        //清除选择车辆信息
        private void button1_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem != null)
            {
                string clear_RID = listBox1.SelectedItem.ToString();
                VanetRIDal VRD_clear = new VanetRIDal();
                if (VRD_clear.clearRID(clear_RID))
                {
                    listBox1.Items.Remove(clear_RID);
                }
            }
        }
        //清除所有车辆信息
        private void button2_Click(object sender, EventArgs e)
        {
            VanetRIDal VRD_clear_all = new VanetRIDal();
            if(VRD_clear_all.clearAllRID())
            {
                listBox1.Items.Clear();
            }

        }
    }
}
